<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:rich="http://richfaces.org/rich">

    <h:head>
        <title>Goalkeeper E-Shop</title>
        <h:outputStylesheet library="css" name="style.css" />
    </h:head>
    <h:body>

        <ui:composition template="template.xhtml">
            <ui:define name="content">
                <br/>
                <h:outputText styleClass="h1" value="#{msg.shoppingCart}" />
                <br/>
                <br/>
                <h:messages styleClass="h2" />
                <br/>
                <h:form>
                    <rich:dataTable id="data" value="#{shoppingCartBean.shoppingCart}" var="product">
                        <f:facet name="noData">#{msg.overviewNoData}</f:facet>                        
                        <rich:column>
                            <f:facet name="header">
                                <h:outputText value="#{msg.overviewCategory}" />
                            </f:facet>
                            <h:outputText value="#{product.category.name}" />
                        </rich:column>
                        <rich:column>
                            <f:facet name="header">
                                <h:outputText value="#{msg.overviewLabel}" />
                            </f:facet>
                            <h:outputText value="#{product.label.name}" />
                        </rich:column>                        
                        <rich:column>
                            <f:facet name="header">
                                <h:outputText value="#{msg.overviewName}" />
                            </f:facet>
                            <h:outputText value="#{product.name}" />
                        </rich:column>                        
                        <rich:column>
                            <f:facet name="header">
                                <h:outputText value="#{msg.overviewSize}" />
                            </f:facet>
                            <h:outputText value="#{product.size}" />
                        </rich:column>
                        <rich:column>
                            <f:facet name="header">
                                <h:outputText value="#{msg.overviewPrice}" />
                            </f:facet>
                            <h:outputText value="#{product.price}">
                                <f:convertNumber type="currency" currencySymbol="€" />
                            </h:outputText>
                            <f:facet name="footer">
                                <h:outputText value="#{shoppingCartBean.price}">
                                    <f:convertNumber type="currency" currencySymbol="€" />
                                </h:outputText>
                            </f:facet>
                        </rich:column>                        
                        <rich:column style="text-align: center">
                            <f:facet name="header">
                                <h:outputText value="#{msg.deleteProduct}" />
                            </f:facet>
                            <h:commandLink action="#{shoppingCartBean.deleteProduct}">
                                <h:graphicImage library="img" name="delete.jpg" />
                                <f:param name="index" value="#{product.id}" />
                            </h:commandLink>
                        </rich:column>
                    </rich:dataTable>
                    <br/>
                    <rich:panel style="text-align: left; width: 200px;" header="#{msg.shoppingOverview}">
                        <table border="0">
                            <tr>
                                <td align="left">#{msg.shoppingDetailsCount}</td>
                                <td align="right">#{shoppingCartBean.count}</td>
                            </tr>
                            <tr>
                                <td align="left">#{msg.shoppingDetailsPrice}</td>
                                <td align="right">#{shoppingCartBean.price} €</td>
                            </tr>
                        </table>
                    </rich:panel>
                    <br/>
                    <h:commandLink action="#{shoppingCartBean.downloadPdf}">
                        <h:graphicImage library="img" name="pdf.jpg" />
                    </h:commandLink>
                </h:form>
                <br/>
                <br/>
            </ui:define>
        </ui:composition>

    </h:body>
</html>
